﻿
@{
    Layout = null;
}
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <link href="~/Content/Css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="~/Content/Css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="~/Content/Css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="~/Content/Css/animate.css" rel="stylesheet">
    <link href="~/Content/Css/style.css?v=4.1.0" rel="stylesheet">
    <title>Insert</title>
    <link href="/Content/Css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="~/Content/common.css" rel="stylesheet"> 
    <style>
        /*.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12,
        .col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12,
        .btn-group {
            border-style: solid;
            border-width: 1px;
            border-color: #000;
        }*/
        .col-xs-4 {
            padding-right:0px;
        }
    </style>
</head>
<body>
    <div class="wrapper wrapper-content animated fadeInRight">
        <form class="form-horizontal m-t" id="mainForm">
            <div class="col-sm-12">
                <div class="row">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">名称：</label>
                            <div class="col-xs-8">
                                <input id="Name" name="Name" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入名称</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">地址：</label>
                            <div class="col-xs-8">
                                <input id="Address" name="Address" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入地址</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">开发商：</label>
                            <div class="col-xs-8">
                                <input id="Developer" name="Developer" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入开发商</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">楼盘省份：</label>
                            <div class="col-xs-8">
                                <select class="form-control" name="ProvinceID" id="ProvinceID">
                                    <option value="">请选择省份</option>
                                </select>
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请选择省份</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">楼盘城市：</label>
                            <div class="col-xs-8">
                                <select class="form-control" name="CityID" id="CityID">
                                    <option value="">请选择城市</option>
                                </select>
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请选择城市</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">楼盘地区：</label>
                            <div class="col-xs-8">
                                <select class="form-control" name="AreaID" id="AreaID">
                                    <option value="">请选择地区</option>
                                </select>
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请选择地区</span>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">户型面积：</label>
                            <div class="col-xs-8">
                                <input id="HouseTypeArea" name="HouseTypeArea" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入户型面积</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">开盘时间：</label>
                            <div class="col-xs-8">
                                <input class="form-control layer-date" id="start" name="OpeningTime">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填选择开盘时间</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">交房时间：</label>
                            <div class="col-xs-8"> 
                                <input class="form-control layer-date" id="end" name="LaunchTime">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填选择交房时间</span>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">物业公司：</label>
                            <div class="col-xs-8">
                                <input id="PropertyManagementCompany" name="PropertyManagementCompany" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入物业公司</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">物业费：</label>
                            <div class="col-xs-8">
                                <input id="PropertyManagementFee" name="PropertyManagementFee" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入物业费</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">开发商品牌：</label>
                            <div class="col-xs-8">
                                <input id="DeveloperBrand" name="DeveloperBrand" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入开发商品牌</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">建筑面积：</label>
                            <div class="col-xs-8">
                                <input id="CoveredArea" name="CoveredArea" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入建筑面积</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">总户数：</label>
                            <div class="col-xs-8">
                                <input id="TotalHouseholds" name="TotalHouseholds" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入总户数</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">容积率：</label>
                            <div class="col-xs-8">
                                <input id="PlotRatio" name="PlotRatio" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入容积率</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">车位数：</label>
                            <div class="col-xs-8">
                                <input id="CarNumber" name="CarNumber" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入车位数</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">车位比：</label>
                            <div class="col-xs-8">
                                <input id="ParkingRatio" name="ParkingRatio" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入车位比</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">绿化率：</label>
                            <div class="col-xs-8">
                                <input id="GreeningRatio" name="GreeningRatio" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入绿化率</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">生活配套：</label>
                            <div class="col-xs-8">
                                <input id="LivingFacilities" name="LivingFacilities" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入生活配套</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">学区配套：</label>
                            <div class="col-xs-8">
                                <input id="SchoolDistrict" name="SchoolDistrict" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入学区配套</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">交通出行：</label>
                            <div class="col-xs-8">
                                <input id="Transportation" name="Transportation" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入交通出行</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">品牌优势：</label>
                            <div class="col-xs-8">
                                <input id="BrandAdvantage" name="BrandAdvantage" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入品牌优势</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">价格优势：</label>
                            <div class="col-xs-8">
                                <input id="PriceAdvantage" name="PriceAdvantage" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入价格优势</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">竞品对比：</label>
                            <div class="col-xs-8">
                                <input id="HaveProductComparison" name="HaveProductComparison" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入竞品对比</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">区域发展：</label>
                            <div class="col-xs-8">
                                <input id="RegionalDevelopment" name="RegionalDevelopment" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入区域发展</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">项目特色：</label>
                            <div class="col-xs-8">
                                <input id="Characteristic" name="Characteristic" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入项目特色</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">备注：</label>
                            <div class="col-xs-8">
                                <input id="Remark" name="Remark" type="text" class="form-control">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填输入备注</span>
                            </div>
                        </div>
                    </div>
                </div>  
                <div class="col-sm-12" style="margin-top:10px;">
                    <button id="submit" class="btn btn-primary pull-right" type="submit">
                        <i class="fa fa-check"></i>&nbsp;提&nbsp;交
                    </button>
                </div>
            </div>
        </form>
    </div>


    <!-- 全局js -->
    <script type="text/javascript" src="~/Scripts/jquery.min.js?v=2.1.4"></script>
    <script type="text/javascript" src="~/Scripts/bootstrap.min.js?v=3.3.6"></script>
    <!-- jQuery Validation plugin javascript-->
    <script type="text/javascript" src="~/Scripts/plugins/validate/jquery.validate.min.js"></script>
    <script type="text/javascript" src="~/Scripts/plugins/validate/messages_zh.min.js"></script>
    <script type="text/javascript" src="~/Scripts/Extensions/ExtValidator.js"></script>
    <!-- layerDate plugin javascript -->
    <script src="~/Scripts/plugins/layer/laydate/laydate.js"></script>
    <!-- layer javascript -->
    <script type="text/javascript" src="~/Scripts/plugins/layer/layer.min.js"></script>
    <script src="/Scripts/plugins/iCheck/icheck.min.js"></script>

    <script type="text/javascript"> 
        $(function () { 
            var icon = "<i class='fa fa-times-circle'></i> ";
            var validator = $("#mainForm").validate({
                rules: {
                    Name: { required: true },
                    Address: { required: true, },
                    ProvinceID: { required: true },
                    CityID: { required: true },
                    AreaID: { required: true },
                    OpeningTime: { required: true },
                    LaunchTime: { required: true },
                    HouseTypeArea: { required: true }, 
                },
                messages: {
                    Name: { required: icon + "请输入名称" },
                    Address: { required: icon + "请输入地址" }, 
                    ProvinceID: { required: icon + "请选择省" },
                    CityID: { required: icon + "请选择市" },
                    AreaID: { required: icon + "请选择区" },
                    OpeningTime: { required: icon + "请选择开盘时间" },
                    LaunchTime: { required: icon + "请选择交房时间时间" },
                    HouseTypeArea: { required: icon + "请输入户型面积" }, 
                },
                submitHandler: function (form) {
                    $.ajax({
                        url: '/LowPriceHouseBuildings/InsertAsync',
                        type: "post",
                        dataType: "json",
                        data: $('#mainForm').serialize(),
                        success: function (data) {
                            //Info,Success,Warning,Error
                            var type = data.type;
                            if (type == 1) {
                                layer.msg(data.content, { icon: 6, time: 2000 },
                                    function () {
                                        var index = parent.layer.getFrameIndex(window.name);
                                        parent.layer.close(index);
                                    });

                            } else {
                                layer.msg(data.content, { icon: 5, time: 2000 });
                            }
                        }
                    });
                }
            });
        });
        GetProvince();//加载省份
        $("#ProvinceID").change(function () { GetCity() });//加载城市
        $("#CityID").change(function () { GetDistrict() });//加载区县
        function GetProvince() {
            $("#ProvinceID").empty();//清空省份SELECT控件
            $.getJSON("/LowPriceHouse/LowPriceHouseBuildings/GetProvincelist", function (data) {
                $("<option></option>").val("").text("省份").appendTo($("#ProvinceID"));
                $.each(data, function (i, item) {
                    $("<option></option>").val(item["id"]).text(item["name"]).appendTo($("#ProvinceID"));
                })
                GetCity();
            });
        }
        function GetCity() {
            $("#CityID").empty();//清空城市SELECT控件
            $.getJSON(
            "/LowPriceHouse/LowPriceHouseBuildings/GetCitylist",
            { pid: $("#ProvinceID").val() },
            function (data) {
                $("<option></option>").val("").text("城市").appendTo($("#CityID"));
                $.each(data, function (i, item) {
                    $("<option></option>").val(item["id"]).text(item["name"]).appendTo($("#CityID"));
                })
                GetDistrict();
            });
        }
        function GetDistrict() {
            $("#AreaID").empty();//清空区县SELECT控件
            $.getJSON(
                "/LowPriceHouse/LowPriceHouseBuildings/GetDistrictlist",
                {
                    cid: $("#CityID").val()
                },
                function (data) {
                    $("<option></option>").val("").text("区域").appendTo($("#AreaID"));
                    $.each(data, function (i, item) {
                        $("<option></option>").val(item["id"]).text(item["name"]).appendTo($("#AreaID"));
                    })
                });
        }
        //日期范围限制
        var start = {
            elem: '#start',
            format: 'YYYY/MM/DD hh:mm:ss',
            min: '1899-06-16 23:59:59', //设定最小日期为当前日期
            max: '2099-06-16 23:59:59', //最大日期
            istime: true,
            istoday: false,
            choose: function (datas) {
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };
        var end = {
            elem: '#end',
            format: 'YYYY/MM/DD hh:mm:ss',
            min: '1899-06-16 23:59:59',
            max: '2099-06-16 23:59:59',
            istime: true,
            istoday: false,
            choose: function (datas) {
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        }; 
        laydate(start);
        laydate(end);
    </script>
</body>
</html>
   